import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * user:likai
 * Date:2022-09-07
 * Time:14:47
 */
public class test {
    public static int fanc(int x){
        if(x==1){
            return 1;
        }
        return x*fanc(x-1);
    }
    public static void main1(String[] args) {
        int n=5;
        int ret=fanc(n);
        System.out.println(ret);

    }
    public static void fun(int x){
        if(x/10==0){
            System.out.println(x);
        }else{
            System.out.println(x%10);
            fun(x/10);
         }
    }

    public static void main2(String[] args) {
        int n=1234;
        fun(n);
    }
    public static int fun1(int x){
        if(x/10==0){
            return x;
        }else{
            return fun1(x/10)+x%10;
         }
    }

    public static void main3(String[] args) {
        int n=1234;
        int sum=fun1(n);
        System.out.println(sum);
    }

    public static int fib(int n){
        if(n==1||n==2){
            return 1;
        }else{
          return fib(n-1)+fib(n-2);
         }
    }
    public static void main4(String[] args) {
        int n=10;
        int sum=fib(n);
        System.out.println(sum);
    }
    //汉洛塔
    //1起始 2中转 3目标
    public static void hanio(int n,char pos1,char pos2,char pos3){
        if(n==1){
            move(pos1,pos3);
            return;
        }
        hanio(n-1,pos1,pos3,pos2);
        move(pos1,pos3);
        hanio(n-1,pos2,pos1,pos3);
    }
    public static void move(char pos1,char pos2){
        System.out.println(pos1+"->"+pos2);
    }
    public static void main5(String[] args) {
        int n=4;
        char pos1='p';
        char pos2='o';
        char pos3='s';
        hanio(n,pos1,pos2,pos3);
    }


    //数组的输出方式
//    public static void main5(String[] args) {
//        int[]array={1,2,3};
//        for (int i = 0; i < array.length ; i++) {
//            System.out.println(array [i]);
//        }
//        for (int x:array) {
//            System.out.println(x);
//        }
//        String ret =Arrays.toString(array);
//        System.out.println(ret);
//    }

    public static void main(String[] args) {
          //int []array1={1,2,3,4,5};
          int i=0;

//        for(int x:array1){
//            System.out.println(x);
//        }
//        for (int i = 0; i < array1.length; i++) {
//            System.out.println(array1[i]);
//        }
        //   System.out.println(array1[3]);//输出4
        ////        System.out.println(array2[2]);//输出8

        int []array2={6,7,8,9};
        int []array1={1,2,3,4,5};
        array1 =array2;
        System.out.println(Arrays.toString(array1));
        System.out.println(Arrays.toString(array2));

    }
}
